Lab 8 - Simple Harmonic Oscillator states

Problems from Chapter 12


In [1]:
from numpy import sqrt
from qutip import *

Define the standard operators


In [18]:
N = 10  # pick a size for our state-space
a = destroy(N)
n = a.dag()*a

Problem 12.1:


In [19]:
a*a.dag() - a.dag()*a


Out[19]:
Quantum object: dims = [[10], [10]], shape = (10, 10), type = oper, isherm = True\begin{equation*}\left(\begin{array}{*{11}c}1.0 & 0.0 & 0.0 & 0.0 & 0.0 & 0.0 & 0.0 & 0.0 & 0.0 & 0.0\\0.0 & 1.0 & 0.0 & 0.0 & 0.0 & 0.0 & 0.0 & 0.0 & 0.0 & 0.0\\0.0 & 0.0 & 1.000 & 0.0 & 0.0 & 0.0 & 0.0 & 0.0 & 0.0 & 0.0\\0.0 & 0.0 & 0.0 & 1.0 & 0.0 & 0.0 & 0.0 & 0.0 & 0.0 & 0.0\\0.0 & 0.0 & 0.0 & 0.0 & 1.0 & 0.0 & 0.0 & 0.0 & 0.0 & 0.0\\0.0 & 0.0 & 0.0 & 0.0 & 0.0 & 1.000 & 0.0 & 0.0 & 0.0 & 0.0\\0.0 & 0.0 & 0.0 & 0.0 & 0.0 & 0.0 & 1.0 & 0.0 & 0.0 & 0.0\\0.0 & 0.0 & 0.0 & 0.0 & 0.0 & 0.0 & 0.0 & 1.0 & 0.0 & 0.0\\0.0 & 0.0 & 0.0 & 0.0 & 0.0 & 0.0 & 0.0 & 0.0 & 1.000 & 0.0\\0.0 & 0.0 & 0.0 & 0.0 & 0.0 & 0.0 & 0.0 & 0.0 & 0.0 & -9.0\\\end{array}\right)\end{equation*}

Problem 12.2:


In [20]:
n*a.dag() - a.dag()*n


Out[20]:
Quantum object: dims = [[10], [10]], shape = (10, 10), type = oper, isherm = False\begin{equation*}\left(\begin{array}{*{11}c}0.0 & 0.0 & 0.0 & 0.0 & 0.0 & 0.0 & 0.0 & 0.0 & 0.0 & 0.0\\1.0 & 0.0 & 0.0 & 0.0 & 0.0 & 0.0 & 0.0 & 0.0 & 0.0 & 0.0\\0.0 & 1.414 & 0.0 & 0.0 & 0.0 & 0.0 & 0.0 & 0.0 & 0.0 & 0.0\\0.0 & 0.0 & 1.732 & 0.0 & 0.0 & 0.0 & 0.0 & 0.0 & 0.0 & 0.0\\0.0 & 0.0 & 0.0 & 2.0 & 0.0 & 0.0 & 0.0 & 0.0 & 0.0 & 0.0\\0.0 & 0.0 & 0.0 & 0.0 & 2.236 & 0.0 & 0.0 & 0.0 & 0.0 & 0.0\\0.0 & 0.0 & 0.0 & 0.0 & 0.0 & 2.449 & 0.0 & 0.0 & 0.0 & 0.0\\0.0 & 0.0 & 0.0 & 0.0 & 0.0 & 0.0 & 2.646 & 0.0 & 0.0 & 0.0\\0.0 & 0.0 & 0.0 & 0.0 & 0.0 & 0.0 & 0.0 & 2.828 & 0.0 & 0.0\\0.0 & 0.0 & 0.0 & 0.0 & 0.0 & 0.0 & 0.0 & 0.0 & 3.000 & 0.0\\\end{array}\right)\end{equation*}

In [21]:
n*a.dag() - a.dag()*n == a.dag()


Out[21]:
True

Problem 12.3 (use n=2 as a test-case):

To define $|2\rangle$ use the basis(N,n) command where N is the dimension of the vector, and n is the quantum number.


In [22]:
psi = basis(N,2)

In [ ]:

Problem 12.5 and 12.6:

These are simple, just view the matrix representation of the operators


In [ ]:

Problem 12.7:

First, define $\hat{X}$ and $\hat{P}$ operators


In [ ]:
X=
P=

In [92]:
psi = 1/sqrt(2)*(basis(N,1)+basis(N,2))

In [ ]:

Problem 12.8:


In [10]:
psi = 1/sqrt(2)*(basis(N,2)+basis(N,4))

In [ ]: